package com.acme.serialization;

import java.io.Serializable;
import java.util.Random;


public class SensorData implements Serializable {
    private double longitude;
    private double latitude;
    private double elevation;
    private double temperature;
    private static Random random = new Random();

    public SensorData(double longitude, double latitude, double elevation, double temperature) {
        this.longitude = longitude;
        this.latitude = latitude;
        this.elevation = elevation;
        this.temperature = temperature;
    }

    public double getLongitude() {
        return longitude;
    }
    public double getLatitude() {
        return latitude;
    }
    public double getElevation() {
        return elevation;
    }
    public double getTemperature() {
        return temperature;
    }

    public static SensorData generate() {
        return new SensorData(
                random.nextDouble(),
                random.nextDouble(),
                random.nextDouble(),
                random.nextDouble());
    }

    @Override
    public String toString() {
        return "SensorData{" +
                "longitude=" + longitude +
                ", latitude=" + latitude +
                ", elevation=" + elevation +
                ", temperature=" + temperature +
                '}';
    }
}